package com.tchhy.mvplibrary.ui.fragment

import com.tchhy.mvplibrary.presenter.BasePresenter
import com.tchhy.mvplibrary.presenter.view.BaseView
import com.tchhy.provider.rx.BaseException

abstract class BaseMvpLazyFragment2<T : BasePresenter<*>>: BaseLazyFragment2(), BaseView {
    lateinit var mPresenter: T
    open fun isShowLoading(): Boolean {
        return true
    }

    override fun showLoading() {
        if (isShowLoading() && !mProgressLoadingDialog!!.isShowing) {
            mProgressLoadingDialog?.showLoading()
        }
    }

    override fun dismissLoading() {
        if (mProgressLoadingDialog!!.isShowing) {
            mProgressLoadingDialog?.dismissLoading()
        }
    }

    override fun onError(throwable: BaseException) {}

    override fun onError(errorMessage: String) {}
}